package cn.com.nes.site.entity.dto.workOrder;

import cn.com.nes.common.em.EmergencyDegreeEnum;
import cn.com.nes.common.em.WorkOrderSourceEnum;
import cn.com.nes.site.entity.em.WorkOrderStautsEnum;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@EqualsAndHashCode
public class WorkOrderListExportDto {

    /**
     * 房屋id
     */
    private Long houseId;
    /**
     * 工单id
     */
    private Long workerOrderId;
    /**
     * 紧急程度
     */
    private Integer emergencyDegreeId;

    /**
     * 紧急程度名称
     */
    private String emergencyDegreeName;

    /**
     * 处理状态
     */
    private Integer workOrderState;


    /**
     * 状态名称
     */
    private String workOrderStateName;

    /**
     * 任务类型
     */
    private Integer workTypeId;

    /**
     * 任务类型名称
     */
    private String workTypeName;

    /**
     * 创建人
     */
    private Long createUserId;
    /**
     * 创建人姓名
     */
    private String createUserName;

    /**
     * 创建时间
     */
    private Long createDate;


    /**
     *  设备信息表（安装日期）
     */
    private Long  azrq;


    /**
     * 创建时间
     */
    private String formattedCreateDate;

    /**
     * 创建时间
     */
    private String formattedAzrqDate;

    /**
     * 设备ids
     */
    private String equipmentIds;

    /**
     * 处理人
     */
    private Long handleUserId;
    /**
     * 处理人名称
     */
    private String handleUserName;

    private String contact;

    private String contactTelephone;

    private String workOrderSource;

    private String xzqhmc;

    /**
     * 处理时间
     */
    private Long handleDate;

    private Integer type;

    /**
     * 厂家名称
     */
    private String cjmc;

    /**
     * 维修人员
     */
    private String wxry;

    /**
     * 故障描述
     */
    private String gzms;

    /**
     * 保修信息(在保/已过保/未录入保修日期)
     */
    private String warrantyState;

    /**
     * 是否已审核
     */
    private String audited;

    private String gzflmc;

    private String gzflmxmc;

    private String gzxxmc;

    private Integer maintainStatus;

    private String visitEval;

    private String desc;

    private String town;

    private String village;

    private String takingTime;

    private String finishTime;

    private String energyType;

    private String installAddress;

    /**
     * 上门时间
     */
    private String doorTime;

    private String handleTypeName;

    private String evaluation;  // 服务细类   字典表WorkOrderEvaluation

    private String evaluationName;  // 服务细类   字典表WorkOrderEvaluation

    /**
     * 催单次数
     */
    private String remindOrderCount;

    public void setEmergencyDegreeId(Integer emergencyDegreeId) {
        this.emergencyDegreeId = emergencyDegreeId;
        if (null != emergencyDegreeId) {
            this.setEmergencyDegreeName(EmergencyDegreeEnum.valueOf("_" + emergencyDegreeId).getVal());
        }
    }

    public void setWorkOrderState(Integer workOrderState) {
        this.workOrderState = workOrderState;
        if (null != workOrderState) {
            this.setWorkOrderStateName(WorkOrderStautsEnum.valueOf("_" + workOrderState).getVal());
        }
    }

    public void setWorkOrderSource(String workOrderSource) {
        if (StrUtil.isNotBlank(workOrderSource)) {
            workOrderSource = WorkOrderSourceEnum.valueOf("_" + workOrderSource).getKey();
        }
        this.workOrderSource = workOrderSource;
    }
}
